package turrets;
import Enemies.Enemy;
import Manage.Counter;
import java.util.ArrayList;
public class Spray extends Turret{
	private static int price = 840;
	public Spray() {
		super();
		price = 840;
		upgradeprice = price / 4;
		sellprice = price / 2;
		setValues(12,1,1);
		Counter.addMoney(-1*(getPrice() - super.getPrice()));
	}
	public int getPrice(){
		return price;
	}
	public String getUpGradeInfo(){
		String s = "Upgrade Number       % increase        Total damage     Price\n" + 
				   "Base                                 0%                     12                       840\n" + 
				   "1st                                  15%                     13                       210\n" +
				   "2nd                                  30%                    16                       420\n" +
				   "3rd                                  45%                     23                       630";
		return s;
	}
	public void act(){
		if(cooldown == -1){
			cooldown = attackspeed;
		}
		if(cooldown == attackspeed){
			ArrayList<Enemy>enemies = getEnemies();
			attack(enemies);
		}
		cooldown--;
	}
	public void playSound(){
		new AePlayWave("SprayShot.wav").start();
	}
	public void attack(ArrayList<Enemy> enemies){
		if(enemies.size() != 0){
			playSound();
		}
		
		for(int x = 0; x<enemies.size();x++){
			enemies.get(x).takeDamage(damage);
		}
	}
}
